3.1081 \(\int \frac {(c+d \tan (e+f x))^3}{(a+i a \tan (e+f x))^2} \, dx\)

Optimal. Leaf size=136 \[ \frac {x \left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right )}{4 a^2}+\frac {(c+i d)^2 (3 d+i c)}{4 a^2 f (1+i \tan (e+f x))}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(-d+i c) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2} \]

[Out]

1/4*(c^3-3*I*c^2*d-3*c*d^2-3*I*d^3)*x/a^2+d^3*ln(cos(f*x+e))/a^2/f+1/4*(c+I*d)^2*(I*c+3*d)/a^2/f/(1+I*tan(f*x+
e))+1/4*(I*c-d)*(c+d*tan(f*x+e))^2/f/(a+I*a*tan(f*x+e))^2

________________________________________________________________________________________

Rubi [A]  time = 0.30, antiderivative size = 136, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {3558, 3589, 3475, 3526, 8} \[ \frac {x \left (-3 i c^2 d+c^3-3 c d^2-3 i d^3\right )}{4 a^2}+\frac {(c+i d)^2 (3 d+i c)}{4 a^2 f (1+i \tan (e+f x))}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(-d+i c) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2} \]

Antiderivative was successfully verified.

[In]

Int[(c + d*Tan[e + f*x])^3/(a + I*a*Tan[e + f*x])^2,x]

[Out]

((c^3 - (3*I)*c^2*d - 3*c*d^2 - (3*I)*d^3)*x)/(4*a^2) + (d^3*Log[Cos[e + f*x]])/(a^2*f) + ((c + I*d)^2*(I*c +
3*d))/(4*a^2*f*(1 + I*Tan[e + f*x])) + ((I*c - d)*(c + d*Tan[e + f*x])^2)/(4*f*(a + I*a*Tan[e + f*x])^2)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3526

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> -Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^m)/(2*a*f*m), x] + Dist[(b*c + a*d)/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1),
 x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0]

Rule 3558

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> -Si
mp[((b*c - a*d)*(a + b*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^(n - 1))/(2*a*f*m), x] + Dist[1/(2*a^2*m), Int[(a
+ b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^(n - 2)*Simp[c*(a*c*m + b*d*(n - 1)) - d*(b*c*m + a*d*(n - 1))
- d*(b*d*(m - n + 1) - a*c*(m + n - 1))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c -
a*d, 0] && EqQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && LtQ[m, 0] && GtQ[n, 1] && (IntegerQ[m] || IntegersQ[2*m,
2*n])

Rule 3589

Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]))/((a_.) + (b_.)*tan[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Dist[(B*d)/b, Int[Tan[e + f*x], x], x] + Dist[1/b, Int[Simp[A*b*c + (A*b*d + B*(
b*c - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a
*d, 0]

Rubi steps

\begin {align*} \int \frac {(c+d \tan (e+f x))^3}{(a+i a \tan (e+f x))^2} \, dx &=\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}-\frac {\int \frac {(c+d \tan (e+f x)) \left (-2 a \left (c^2-2 i c d+d^2\right )+4 i a d^2 \tan (e+f x)\right )}{a+i a \tan (e+f x)} \, dx}{4 a^2}\\ &=\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}+\frac {i \int \frac {-2 a^2 c \left (2 c d+i \left (c^2+d^2\right )\right )-2 a^2 d \left (i c^2+4 c d+3 i d^2\right ) \tan (e+f x)}{a+i a \tan (e+f x)} \, dx}{4 a^3}-\frac {d^3 \int \tan (e+f x) \, dx}{a^2}\\ &=\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(c+i d)^2 (i c+3 d)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}+\frac {\left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right ) \int 1 \, dx}{4 a^2}\\ &=\frac {\left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right ) x}{4 a^2}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(c+i d)^2 (i c+3 d)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 2.42, size = 305, normalized size = 2.24 \[ -\frac {\sec ^2(e+f x) \left (4 i c^3 f x \sin (2 (e+f x))+c^3 \sin (2 (e+f x))+4 i c^3+3 i c^2 d \sin (2 (e+f x))+12 c^2 d f x \sin (2 (e+f x))+\cos (2 (e+f x)) \left (c^3 (4 f x+i)+3 c^2 d (-1-4 i f x)-3 c d^2 (4 f x+i)+8 d^3 \log \left (\cos ^2(e+f x)\right )+d^3 (1+4 i f x)\right )-3 c d^2 \sin (2 (e+f x))-12 i c d^2 f x \sin (2 (e+f x))+12 i c d^2-i d^3 \sin (2 (e+f x))-4 d^3 f x \sin (2 (e+f x))+8 i d^3 \sin (2 (e+f x)) \log \left (\cos ^2(e+f x)\right )+16 d^3 \tan ^{-1}(\tan (f x)) (\sin (2 (e+f x))-i \cos (2 (e+f x)))-8 d^3\right )}{16 a^2 f (\tan (e+f x)-i)^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(c + d*Tan[e + f*x])^3/(a + I*a*Tan[e + f*x])^2,x]

[Out]

-1/16*(Sec[e + f*x]^2*((4*I)*c^3 + (12*I)*c*d^2 - 8*d^3 + Cos[2*(e + f*x)]*(3*c^2*d*(-1 - (4*I)*f*x) + d^3*(1
+ (4*I)*f*x) + c^3*(I + 4*f*x) - 3*c*d^2*(I + 4*f*x) + 8*d^3*Log[Cos[e + f*x]^2]) + c^3*Sin[2*(e + f*x)] + (3*
I)*c^2*d*Sin[2*(e + f*x)] - 3*c*d^2*Sin[2*(e + f*x)] - I*d^3*Sin[2*(e + f*x)] + (4*I)*c^3*f*x*Sin[2*(e + f*x)]
 + 12*c^2*d*f*x*Sin[2*(e + f*x)] - (12*I)*c*d^2*f*x*Sin[2*(e + f*x)] - 4*d^3*f*x*Sin[2*(e + f*x)] + (8*I)*d^3*
Log[Cos[e + f*x]^2]*Sin[2*(e + f*x)] + 16*d^3*ArcTan[Tan[f*x]]*((-I)*Cos[2*(e + f*x)] + Sin[2*(e + f*x)])))/(a
^2*f*(-I + Tan[e + f*x])^2)

________________________________________________________________________________________

fricas [A]  time = 0.52, size = 126, normalized size = 0.93 \[ \frac {{\left (16 \, d^{3} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + {\left (4 \, c^{3} - 12 i \, c^{2} d - 12 \, c d^{2} - 28 i \, d^{3}\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} + i \, c^{3} - 3 \, c^{2} d - 3 i \, c d^{2} + d^{3} + {\left (4 i \, c^{3} + 12 i \, c d^{2} - 8 \, d^{3}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{16 \, a^{2} f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/16*(16*d^3*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + (4*c^3 - 12*I*c^2*d - 12*c*d^2 - 28*I*d^3)*f*x
*e^(4*I*f*x + 4*I*e) + I*c^3 - 3*c^2*d - 3*I*c*d^2 + d^3 + (4*I*c^3 + 12*I*c*d^2 - 8*d^3)*e^(2*I*f*x + 2*I*e))
*e^(-4*I*f*x - 4*I*e)/(a^2*f)

________________________________________________________________________________________

giac [A]  time = 1.14, size = 226, normalized size = 1.66 \[ -\frac {\frac {2 \, {\left (-i \, c^{3} - 3 \, c^{2} d + 3 i \, c d^{2} + d^{3}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{a^{2}} + \frac {2 \, {\left (i \, c^{3} + 3 \, c^{2} d - 3 i \, c d^{2} + 7 \, d^{3}\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{a^{2}} + \frac {-3 i \, c^{3} \tan \left (f x + e\right )^{2} - 9 \, c^{2} d \tan \left (f x + e\right )^{2} + 9 i \, c d^{2} \tan \left (f x + e\right )^{2} - 21 \, d^{3} \tan \left (f x + e\right )^{2} - 10 \, c^{3} \tan \left (f x + e\right ) + 30 i \, c^{2} d \tan \left (f x + e\right ) - 18 \, c d^{2} \tan \left (f x + e\right ) + 22 i \, d^{3} \tan \left (f x + e\right ) + 11 i \, c^{3} + 9 \, c^{2} d + 15 i \, c d^{2} + 5 \, d^{3}}{a^{2} {\left (\tan \left (f x + e\right ) - i\right )}^{2}}}{16 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e))^2,x, algorithm="giac")

[Out]

-1/16*(2*(-I*c^3 - 3*c^2*d + 3*I*c*d^2 + d^3)*log(tan(f*x + e) + I)/a^2 + 2*(I*c^3 + 3*c^2*d - 3*I*c*d^2 + 7*d
^3)*log(tan(f*x + e) - I)/a^2 + (-3*I*c^3*tan(f*x + e)^2 - 9*c^2*d*tan(f*x + e)^2 + 9*I*c*d^2*tan(f*x + e)^2 -
 21*d^3*tan(f*x + e)^2 - 10*c^3*tan(f*x + e) + 30*I*c^2*d*tan(f*x + e) - 18*c*d^2*tan(f*x + e) + 22*I*d^3*tan(
f*x + e) + 11*I*c^3 + 9*c^2*d + 15*I*c*d^2 + 5*d^3)/(a^2*(tan(f*x + e) - I)^2))/f

________________________________________________________________________________________

maple [B]  time = 0.29, size = 362, normalized size = 2.66 \[ \frac {3 \ln \left (\tan \left (f x +e \right )+i\right ) c^{2} d}{8 f \,a^{2}}-\frac {\ln \left (\tan \left (f x +e \right )+i\right ) d^{3}}{8 f \,a^{2}}-\frac {3 i c^{2} d}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {3 i c \,d^{2}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}+\frac {i \ln \left (\tan \left (f x +e \right )+i\right ) c^{3}}{8 f \,a^{2}}+\frac {5 i d^{3}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {c^{3}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {9 c \,d^{2}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {3 c^{2} d}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {d^{3}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {i \ln \left (\tan \left (f x +e \right )-i\right ) c^{3}}{8 f \,a^{2}}+\frac {3 i \ln \left (\tan \left (f x +e \right )-i\right ) c \,d^{2}}{8 f \,a^{2}}-\frac {3 i \ln \left (\tan \left (f x +e \right )+i\right ) c \,d^{2}}{8 f \,a^{2}}-\frac {i c^{3}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {3 \ln \left (\tan \left (f x +e \right )-i\right ) c^{2} d}{8 f \,a^{2}}-\frac {7 \ln \left (\tan \left (f x +e \right )-i\right ) d^{3}}{8 f \,a^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e))^2,x)

[Out]

3/8/f/a^2*ln(tan(f*x+e)+I)*c^2*d-1/8/f/a^2*ln(tan(f*x+e)+I)*d^3-3/4*I/f/a^2/(tan(f*x+e)-I)*c^2*d+3/4*I/f/a^2/(
tan(f*x+e)-I)^2*c*d^2+1/8*I/f/a^2*ln(tan(f*x+e)+I)*c^3+5/4*I/f/a^2/(tan(f*x+e)-I)*d^3+1/4/f/a^2/(tan(f*x+e)-I)
*c^3+9/4/f/a^2/(tan(f*x+e)-I)*c*d^2+3/4/f/a^2/(tan(f*x+e)-I)^2*c^2*d-1/4/f/a^2/(tan(f*x+e)-I)^2*d^3-1/8*I/f/a^
2*ln(tan(f*x+e)-I)*c^3+3/8*I/f/a^2*ln(tan(f*x+e)-I)*c*d^2-3/8*I/f/a^2*ln(tan(f*x+e)+I)*c*d^2-1/4*I/f/a^2/(tan(
f*x+e)-I)^2*c^3-3/8/f/a^2*ln(tan(f*x+e)-I)*c^2*d-7/8/f/a^2*ln(tan(f*x+e)-I)*d^3

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

mupad [B]  time = 5.66, size = 184, normalized size = 1.35 \[ \frac {\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {3\,c^2\,d}{4\,a^2}-\frac {5\,d^3}{4\,a^2}+\frac {c^3\,1{}\mathrm {i}}{4\,a^2}+\frac {c\,d^2\,9{}\mathrm {i}}{4\,a^2}\right )+\frac {c^3}{2\,a^2}+\frac {3\,c\,d^2}{2\,a^2}+\frac {d^3\,1{}\mathrm {i}}{a^2}}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (-c^3\,1{}\mathrm {i}-3\,c^2\,d+c\,d^2\,3{}\mathrm {i}+d^3\right )}{8\,a^2\,f}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (c^3\,1{}\mathrm {i}+3\,c^2\,d-c\,d^2\,3{}\mathrm {i}+7\,d^3\right )}{8\,a^2\,f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d*tan(e + f*x))^3/(a + a*tan(e + f*x)*1i)^2,x)

[Out]

(tan(e + f*x)*((c^3*1i)/(4*a^2) - (5*d^3)/(4*a^2) + (c*d^2*9i)/(4*a^2) + (3*c^2*d)/(4*a^2)) + c^3/(2*a^2) + (d
^3*1i)/a^2 + (3*c*d^2)/(2*a^2))/(f*(2*tan(e + f*x) + tan(e + f*x)^2*1i - 1i)) - (log(tan(e + f*x) + 1i)*(c*d^2
*3i - 3*c^2*d - c^3*1i + d^3))/(8*a^2*f) - (log(tan(e + f*x) - 1i)*(3*c^2*d - c*d^2*3i + c^3*1i + 7*d^3))/(8*a
^2*f)

________________________________________________________________________________________

sympy [A]  time = 1.07, size = 398, normalized size = 2.93 \[ \begin {cases} \frac {\left (\left (16 i a^{2} c^{3} f e^{4 i e} + 48 i a^{2} c d^{2} f e^{4 i e} - 32 a^{2} d^{3} f e^{4 i e}\right ) e^{- 2 i f x} + \left (4 i a^{2} c^{3} f e^{2 i e} - 12 a^{2} c^{2} d f e^{2 i e} - 12 i a^{2} c d^{2} f e^{2 i e} + 4 a^{2} d^{3} f e^{2 i e}\right ) e^{- 4 i f x}\right ) e^{- 6 i e}}{64 a^{4} f^{2}} & \text {for}\: 64 a^{4} f^{2} e^{6 i e} \neq 0 \\x \left (- \frac {c^{3} - 3 i c^{2} d - 3 c d^{2} - 7 i d^{3}}{4 a^{2}} + \frac {i \left (- i c^{3} e^{4 i e} - 2 i c^{3} e^{2 i e} - i c^{3} - 3 c^{2} d e^{4 i e} + 3 c^{2} d + 3 i c d^{2} e^{4 i e} - 6 i c d^{2} e^{2 i e} + 3 i c d^{2} - 7 d^{3} e^{4 i e} + 4 d^{3} e^{2 i e} - d^{3}\right ) e^{- 4 i e}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} + \frac {d^{3} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a^{2} f} - \frac {x \left (- c^{3} + 3 i c^{2} d + 3 c d^{2} + 7 i d^{3}\right )}{4 a^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))**3/(a+I*a*tan(f*x+e))**2,x)

[Out]

Piecewise((((16*I*a**2*c**3*f*exp(4*I*e) + 48*I*a**2*c*d**2*f*exp(4*I*e) - 32*a**2*d**3*f*exp(4*I*e))*exp(-2*I
*f*x) + (4*I*a**2*c**3*f*exp(2*I*e) - 12*a**2*c**2*d*f*exp(2*I*e) - 12*I*a**2*c*d**2*f*exp(2*I*e) + 4*a**2*d**
3*f*exp(2*I*e))*exp(-4*I*f*x))*exp(-6*I*e)/(64*a**4*f**2), Ne(64*a**4*f**2*exp(6*I*e), 0)), (x*(-(c**3 - 3*I*c
**2*d - 3*c*d**2 - 7*I*d**3)/(4*a**2) + I*(-I*c**3*exp(4*I*e) - 2*I*c**3*exp(2*I*e) - I*c**3 - 3*c**2*d*exp(4*
I*e) + 3*c**2*d + 3*I*c*d**2*exp(4*I*e) - 6*I*c*d**2*exp(2*I*e) + 3*I*c*d**2 - 7*d**3*exp(4*I*e) + 4*d**3*exp(
2*I*e) - d**3)*exp(-4*I*e)/(4*a**2)), True)) + d**3*log(exp(2*I*f*x) + exp(-2*I*e))/(a**2*f) - x*(-c**3 + 3*I*
c**2*d + 3*c*d**2 + 7*I*d**3)/(4*a**2)

________________________________________________________________________________________